package com.health.ts.controller.sysmanage;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.health.ts.constant.ApiResult;
import com.health.ts.controller.BaseController;
import com.health.ts.entity.sysmanage.SysDict;
import com.health.ts.service.sysmanage.SysDictService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * 字典信息controller
 * @author Administrator
 */
@Api(value = "字典信息接口", tags = {"字典信息接口"})
@RestController
@RequestMapping(value = "/api",produces= BaseController.JSON_UTF8)
public class DictController extends BaseController{
	
	@Autowired
	SysDictService sysDictService;
	
	/**
	 * 查询字典信息(不带分页)
	 * @return
	 */
    @ApiOperation(value = "查询字典信息(不带分页)", notes = "查询字典信息(不带分页)")
	@RequestMapping(value = "/dictInfos",method=RequestMethod.GET)
    @Cacheable(value="dict")
	public ApiResult listDict(String group_code) {
		QueryWrapper<SysDict> wrapper = new QueryWrapper<SysDict>();
		if(StringUtils.isNotEmpty(group_code)){
			wrapper.eq("group_code", group_code).eq("valid_status", "1");
		}
		wrapper.eq("valid_status", "1");
		List<SysDict> list=sysDictService.list(wrapper);
		return ApiResult.success(list);
	}
}
